create database  student
on

(

	name='student',

	filename='D:\student.mdf',

	size=10,

	maxsize=100,

	filegrowth=10

)

log on

(

	name='student_log',

	filename='D:\student_log.ldf',

	size=10,

	maxsize=100,

	filegrowth=10

)


use   student

go

create table ban 
( classid int  identity(1,1) primary key,
  banjim varchar(20)not null,
  kaiban int null,
  banjimiao int 

)
create table xue

( xuehao int  identity(1,1) primary key,
  xing varchar(10) not null unique check(len( xing)>2),
  userSex varchar(1)  default('') check(usersex='男'or usersex='女' ) not null,
  userAge int not null  check(userAge>=15 and userAge<=40),
  userAddress  varchar(10) default('123456'),
  userSection  int references ban(classid)
)
create table ke
( keche int  identity(1,1) primary key,
  kename varchar(20) not null,
  kechengmiaosgy int
)
create table cheng
( bian int  identity(1,1) primary key,
  sadsad int references xue(xuehao) null,
  sadsadss int references ke(keche) null,
  sadf int check(sadf>0 and sadf<=100)


)